/**
 * \file serializer.h
 * \brief Serializer class header
 * \author Marc Laval
 * \version 0.1
 * \date 10/2011
 *
 */

#include <string>
#include "types.h"

#ifndef _SERIALIZER_H_
#define _SERIALIZER_H_

using std::string;

/*! \brief Serializes data to a ByteBuffer.
 *  \class Serializer
 *
 * For each data Serialization, the data is splitted into bytes and written into the
 * ByteBuffer.
 */
class Serializer
{

protected :
	ByteBuffer * m_buf;		///<  Byte buffer

public :

	/*! \brief Standard constructor
	 *  \param buf CommandBuffer
	 */
	Serializer(ByteBuffer * buf);

	/*! \brief Serializes data and add it to the buffer
	 *  \param data unsigned 8bit int
	 */
	bool serialize(uint8 data);

	/*! \brief Serializes data and add it to the buffer
	 *  \param data unsigned 16bit int
	 */
	bool serialize(uint16 data);

	/*! \brief Serializes data and add it to the buffer
	 *  \param data unsigned 32bit int
	 */
	bool serialize(uint32 data);

	/*! \brief Serializes data and add it to the buffer
	 *  \param data unsigned 64bit int
	 */
	bool serialize(uint64 data);

	/*! \brief Serializes data and add it to the buffer
	 *  \param data boolean
	 */
	bool serialize(bool data);

	/*! \brief Serializes data and add it to the buffer
	 *  \param data float
	 */
	bool serialize(float data);

	/*! \brief Serializes data and add it to the buffer
	 *  \param data double
	 */
	bool serialize(double data);

	/*! \brief Serializes data and add it to the buffer
	 *  \param data string
	 */
	bool serialize(string data);

};

#endif //_SERIALIZER_H_
